Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Schematics): Rename default action type for action blueprint #1047

Merged
merged 1 commit into from
May 10, 2018

Conversation

brandonroberts
Copy link
Member

Closes #1040

BREAKING CHANGE:

The action blueprint has been updated to be less generic, with associated reducer and effects updated for the feature blueprint

BEFORE:

export enum UserActionTypes {
UserAction = '[User] Action'
}

export class User implements Action {
readonly type = UserActionTypes.UserAction;
}

export type UserActions = User;

AFTER:

export enum UserActionTypes {
LoadUsers = '[User] Load Users'
}

export class LoadUsers implements Action {
readonly type = UserActionTypes.LoadUsers;
}

export type UserActions = LoadUsers;

Closes #1040

BREAKING CHANGE:

The action blueprint has been updated to be less generic, with associated reducer and effects updated for the feature blueprint

BEFORE:

export enum UserActionTypes {
  UserAction = '[User] Action'
}

export class User implements Action {
  readonly type = UserActionTypes.UserAction;
}

export type UserActions = User;

AFTER:

export enum UserActionTypes {
  LoadUsers = '[User] Load Users'
}

export class LoadUsers implements Action {
  readonly type = UserActionTypes.LoadUsers;
}

export type UserActions = LoadUsers;
@brandonroberts brandonroberts changed the title build: Remove custom build scripts in favor of Bazel builds feat(Schematics): Rename default action type for action blueprint May 10, 2018
@brandonroberts brandonroberts merged commit 4c4e6a9 into master May 10, 2018
@brandonroberts brandonroberts deleted the action-schematic-default branch May 10, 2018 12:37
@@ -6,7 +6,7 @@ import { Actions, Effect } from '@ngrx/effects';
export class <%= classify(name) %>Effects {
<% if(feature) { %>
@Effect()
effect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.<%= classify(name) %>Action);
effect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s);
Copy link
Contributor

@ThomasBurleson ThomasBurleson May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonroberts - you may want to add this:

loadEffect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

}

export type <%= classify(name) %>Actions = <%= classify(name) %>;
export type <%= classify(name) %>Actions = Load<%= classify(name) %>s;
Copy link
Contributor

@ThomasBurleson ThomasBurleson May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonroberts - in the nx schematics, we generate scaffolding for both Load and Loaded and LoadError. And we use union types for the Load/Loaded actions.
e.g.

export type <%= classify(name) %>Actions = 
     Load<%= classify(name) %>s        | 
     <%= classify(name) %>sLoaded      | 
     <%= classify(name) %>sLoadError;

Nx is also missing the s suffix... which I will add/fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants